﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="OsebjeNepedagoskoSeznam.aspx.cs" Inherits="Sio.Mdm.Web.Organizacija.OsebjeNepedagoskoSeznam" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>SIO - MDM :: Organizacija : Pedagoško osebje</title>
    <script type="text/javascript">
				var DelovnaMestaRenderer = function (value) {					
						var r = StoreDelovnaMesta.getById(value);
            if (Ext.isEmpty(r)) { return ""; }
            return r.data.Naziv;
        };
				var PokliciRenderer = function (value) {
						var r = StorePoklici.getById(value);
            if (Ext.isEmpty(r)) { return ""; }
            return r.data.Naziv;
        };

    </script>
</head>
<body>
		<form id="form1" runat="server">
    <ext:ResourceManager ID="ResourceManager1" runat="server" />

    <ext:Store ID="StoreDelovnaMesta" runat="server">
			<Reader>
				<ext:JsonReader IDProperty="DelovnoMestoId">
					<Fields>
						<ext:RecordField Name="DelovnoMestoId" Type="Int" />
						<ext:RecordField Name="Naziv" Type="String" />
					</Fields>
				</ext:JsonReader>
			</Reader>
		</ext:Store>

    <ext:Store ID="StorePoklici" runat="server">
			<Reader>
				<ext:JsonReader IDProperty="PoklicId">
					<Fields>
						<ext:RecordField Name="PoklicId" Type="Int" />
						<ext:RecordField Name="Naziv" Type="String" />
					</Fields>
				</ext:JsonReader>
			</Reader>
		</ext:Store>

    <ext:Viewport ID="Viewport1" runat="server" Layout="Fit">
    <Content>
		                    
		<sio:GridPanel ID="GridKaderSeznam" runat="server" 
			StripeRows="true"
			TrackMouseOver="true"
			Width="700">
      <Plugins>
         <ext:RowEditor ID="RowEditor1" runat="server" SaveText="Shrani" CancelText="Prekliči" ClicksToEdit="2">
            <DirectEvents>
                <AfterEdit OnEvent="UrediPodatke">
									<ExtraParams>
										<ext:Parameter Mode="Raw" Name="data" Value="r.data" />
									</ExtraParams>
								</AfterEdit>
            </DirectEvents></ext:RowEditor>         
      </Plugins>			
		<Store>
			<ext:Store ID="StoreKaderSeznam" runat="server">
			<Reader>
				<ext:JsonReader IDProperty="IdmStevilka">
					<Fields>
						<ext:RecordField Name="IdmStevilka" Type="Int" />
						<ext:RecordField Name="VlogaId" Type="Int" />
						<ext:RecordField Name="Ime" Type="String" />
						<ext:RecordField Name="Priimek" Type="String" />
						<ext:RecordField Name="DelovnoMestoId" Type="Int" />
						<ext:RecordField Name="NazivUciteljaId" Type="Int" />
						<ext:RecordField Name="PoklicId" Type="Int" />
					</Fields>
				</ext:JsonReader>
			</Reader>
			</ext:Store>			
		</Store>
	    
		<ColumnModel ID="ColumnModel1" runat="server">
		<Columns>
			<ext:RowNumbererColumn />
			<ext:Column ColumnID="IdmStevilka" Hidden="true" Hideable="false" DataIndex="IdmStevilka"></ext:Column>			
			<ext:Column ColumnID="VlogaId" Hidden="true" Hideable="false" DataIndex="VlogaId"></ext:Column>			
      <ext:Column ColumnID="Ime" Header="Ime" DataIndex="Ime">
        <Editor><ext:TextField ID="TextField1" runat="server" AllowBlank="false" MinLength="2" MinLengthText="Vpišite ime" BlankText="Vpišite ime" /></Editor>
      </ext:Column>
			<ext:Column Header="Priimek" DataIndex="Priimek">
        <Editor><ext:TextField ID="TextField2" runat="server" AllowBlank="false" MinLength="2" MinLengthText="Vpišite priimek" BlankText="Vpišite priimek" /></Editor>
      </ext:Column>
			<ext:Column Header="Delovno mesto" DataIndex="DelovnoMestoId"  Width=150>
				<Renderer Fn="DelovnaMestaRenderer" />
				<Editor><ext:ComboBox ID="cbDelovnaMesta" runat="server"  TypeAhead="true" SelectOnFocus="true" Editable="true" Mode="Local" ForceSelection="true" 
						StoreID="StoreDelovnaMesta" ValueField="DelovnoMestoId" DisplayField="Naziv" /></Editor>
      </ext:Column>
			<ext:Column Header="Poklic" DataIndex="PoklicId" Width=150>
				<Renderer Fn="PokliciRenderer" />
				<Editor><ext:ComboBox ID="cbPoklic" runat="server" TypeAhead="true" SelectOnFocus="true" Editable="true" Mode="Local" ForceSelection="true" 
						StoreID="StorePoklici" ValueField="PoklicId" DisplayField="Naziv" /></Editor>
      </ext:Column>
			
      <ext:CommandColumn Width="35">
        <Commands>
          <ext:GridCommand Icon="NoteEdit" CommandName="Uredi"><ToolTip Text="Uredi" /></ext:GridCommand>
        </Commands>
      </ext:CommandColumn>

		</Columns>
		</ColumnModel>
	<Listeners>
		  <Command Handler="openTab('../Uporabnik/Akter.aspx', 'Nepedagoški '+record.data.Ime+' '+record.data.Priimek, {idm: record.id }, 'akter'+record.id);" />
		</Listeners>
		
		<SelectionModel>
			<ext:CheckboxSelectionModel ID="CheckboxSelectionModel1" runat="server" />
		</SelectionModel>
		
		<TopBar>
			<ext:Toolbar ID="Toolbar1" runat="server">
			<Items>
				<sio:Button runat="server" ID="Add"	Text="Dodaj" Icon="Add">
				  <Listeners><Click Handler="#{AddKader}.show();" /></Listeners>
				</sio:Button>
				<sio:Button runat="server" ID="Remove"
					Text="Odstrani"
					Icon="Delete">
				<DirectEvents>
					<Click OnEvent="OdstraniKader" >
					<Confirmation ConfirmRequest="true" Message="Izbrišem izbrani kader?" />
					<ExtraParams>
						<ext:Parameter Name="selected" Mode="Raw" Value="Ext.encode(#{GridKaderSeznam}.getRowsValues({selectedOnly:true}))" />
					</ExtraParams>					
					</Click>
				</DirectEvents>						
				</sio:Button>
			</Items>
			</ext:Toolbar>
		</TopBar>
		
		</sio:GridPanel>
    
	</Content>
	</ext:Viewport>
  <sio:Dialog runat="server" ID="AddKader"
		Width="600"
		Height="300"
		Url="NovKader.aspx"
		DialogButtons="SaveClose"
    Title="Dodajanje nepedagoškega kadra">
		<Listeners>		
			<Hide Handler="#{StoreKaderSeznam}.reload();" />
		</Listeners>
    <Parameters>
			<ext:Parameter Name="tipVloge" Value="5" Mode="Raw" />
			<ext:Parameter Name="letoid" Value="Ext.urlDecode(window.location.search.substring(1)).letoid" Mode="Raw" />
		</Parameters>
	</sio:Dialog>	
  </form></body>
</html>
